@include('layout.header')
<link rel="stylesheet" href="{{URL::asset('/ucenter/css/base.css')}}">
<link rel="stylesheet" href="{{URL::asset('/ucenter/css/bootstrap.min.css')}}">
<!--[if lt IE 9]>
<script src="js/bootstrap/html5shiv.min.js"></script>
<script src="js/bootstrap/respond.min.js"></script>
<![endif]-->
<style>
.header_r a img {
    margin-top: 0px;
}
.header > .header_l{
   width:750px;
}
.header > .header_l > .header_lo{
   padding-top:15px;
}
.header > .header_l > .header_lo img{
/*   width:195px;
   height:40px;*/
   padding-top:3px;
}
nav ul li a:hover{
   /*color:#04b1f9; */
   text-decoration:none;
}
nav ul li a:visited{
    text-decoration:none;
}
nav ul li a{
    font-size:16px;
    font-weight:100px;
}
/*注册时间按钮*/
.navTop .personInfo .reg_time {
    width: 90px;
    height: 24px;
    line-height: 22px;
    font-size: 12px;
    border-radius: 5px;
    background-color: #496391;
    color: #fff;
    border: 0 none;
}
.navTop .personInfo .reg_time:hover {
    border: 1px solid #fff;
}
.navTop .subnav .photo a > img{
	width: 100%;
	height:100%;
}
a:hover {
    text-decoration: none;
}
</style>
<!-- 客户中心导航 -->
<div style="clear: both;"></div>
    <div class="nav-personCenter">
        <ul class="nav nav-tabs sub-personCenter" role="tablist">
            @if (session('eai'))
                <li role="presentation" class="active"><a href="{{url::asset('/home?type=user&id='.session('eai')['id'])}}" aria-controls="home">个人主页</a></li>
            @endif
            <li role="presentation"><a href="{{URL('authenticate')}}" aria-controls="profile">我的资料</a></li>
            <li role="presentation"><a href="#commentCenter" aria-controls="messages">评论中心</a></li>
            <!--<li role="presentation"><a href="{{URL('cash')}}" aria-controls="settings">提现</a></li>-->
        </ul>
    </div>
<!-- 客户中心导航结束 -->
    <div class="tab-content">
        <!-- 个人中心开始 -->
        <div role="presentation" class="tab-pane active" id="personHome">
            <!--顶部导航-->
            <div class="navTop">
                <div class="subnav">
                    <div class="person">
                        <!-- 头像 -->
                        <div class="photo">
                            <a href="#" style="width: 62px;height: 62px;display: inline-block">
                                @if (session('eai'))
                                    <img src="{{session('eai')['photo']}}" alt="" id="topphoto">
                                @else
                                    <img src="{{URL::asset('/ucenter/images/head.png')}}" alt="" id="topphoto">
                                @endif
                            </a>
                        </div>

                        <!-- 个人信息描述 -->
                        <div class="personInfo clearfix">
                            <div class="personInfoTop">
                                @if($userinfo->isvip != '0')
                                    <span><img src="{{ URL::asset('/images/vip.png') }}" alt=""></span>
                                @endif
                                <span class="name">{{ $userinfo->username}}</span>
                                <span class="masterimg">
                                    @if($userinfo->authstatus == '2' && $userinfo->isanalyst == '1')
                                        <img src="{{ URL::asset('/images/vip@greatmaster.png') }}" alt="">
                                    @else
                                        <img src="{{ URL::asset('/images/vip@tomorrow.png') }}" alt="">
                                    @endif
                                </span>
<!--                                <span class="pointsImg"></span>
                                <sapn class="points">积分 : 100</sapn>-->
                            </div>

                            <div class="personInfoBottom">
                                <span class="addr" style='display:inline-block;'>所在地：
                                    @if($moreinfo != '')
                                        {{ $moreinfo->province}} {{ $moreinfo->city}} {{ $moreinfo->country}}
                                    @endif
                                </span>
                                <!-- <button class="reg_time">申请体验账户</button> -->
                                <!-- @if($userinfo->hasapply == 0)  <!-- 如果用户没有申请过 --> -->
                                    <!-- <button class="reg_time">申请体验账户</button> -->
                                    <!-- <a id="aBox" style="color: #fff;width:300px;"></a> -->
                                <!-- @else -->
                                    <!-- @if($userinfo->applytime+$tiyan*24*60*60 > time())   <!-- 如果用户已提交申请，并且没有过期，那么从当前时间开始倒计时  --> -->
                                    <!-- <a id="aBox" style="color: #fff;width:300px;">
                                            <script>
                                                $(function(){
                                                    timer = setInterval("daojishi()",1000);
                                                })
                                            </script>
                                    </a>
                                    @else
                                  
                                        <span style="font-size:14px;color:#fff;">您的体验账户已过期，</span><a href="javascript:;" style="font-size:14px;color:#f6a405;cursor:pointer;">请充值！</a>
                                    @endif
                                @endif -->
                            </div>

                        </div>
                    </div>

                    <!-- 赢利点位 -->
                    <div class="integral">
                        <div class="integral-right">
                            <div class="integral-totle-money">
                                <p class="totleNum">
                                    @if($userinfo->jifen != 0)
                                        <span class="pointsImg"></span>{{$userinfo->jifen}}
                                    @else
                                        <span class="pointsImg">0</span>
                                    @endif
                                </p>
                                <p class="totleNumInfo"><img src="{{URL::asset('/ucenter/images/score.png')}}" alt="" />积分</p>
                            </div>

                            <div class="line"></div>

                            <div class="integral-totle-profit">
                                <p class="totleNum">{{ $allprofit }}点</p>
                                <p class="totleNumInfo">策略赢利点位</p>
                            </div>

                            <div class="line"></div>

                            <div class="integral-totle-profit">
                                <p class="totleNum">{{ round($gendanProfit,2) }}点</p>
                                <p class="totleNumInfo">订阅赢利点位</p>
                            </div>

<!--                            <div class="line"></div>

                            <div class="integral-totle-profit">
                                <p class="totleNum">65558点</p>
                                <p class="totleNumInfo">跟赢利点位</p>
                            </div>-->

                        </div>
                    </div>


                </div>
            </div>
        <!-- 顶部导航结束 -->
<script>
    function perfectInfo() {
        $('#mask').hide();
        $('.tanCeng').hide();
    }
</script>
<script>
    var tiyan = '{{ $tiyan }}';
    var maxtime = tiyan*60*60*24; //15天的秒数
    var timer; 
    function CountDown(){    //立即申请账户倒计时
        clearInterval(timer);
        if(maxtime>=0){ 
            // 剩余天数
            var day = Math.floor(maxtime/ 60 / 60 / 24);
            //剩余小时
            var hours = Math.floor(maxtime/ 60 / 60 % 24);
            //剩余分钟数
            var minutes = Math.floor(maxtime % 3600 / 60); 
            var seconds = Math.floor(maxtime % 60); 
            var msg = "<span style='font-size:12px;'>体验账户倒计时： </span>"+"<span style='font-size:14px;'>"+day+"</span>"+"<span style='font-size:12px;'>天</span>"+"<span style='font-size:14px;'>" +hours+"</span>"+"<span style='font-size:12px;'>小时</span>" +"<span style='font-size:14px;'>"+minutes+"</span>"+"<span style='font-size:12px;'>分</span>"+"<span style='font-size:14px;'>"+seconds+"</span>"+"<span style='font-size:12px;'>秒</span>"; 
            $('#aBox').html(msg); 
            --maxtime; 
        }else{ 
            clearInterval(timer); 
            //一下两个方法是倒计时结束后调用的方法 
            $('#aBox').html('您的体验已结束,<a href="javascript:;" style="font-size:14px;color:#f6a405;cursor:pointer;">请充值！</a>');
            timer=setInterval("CountDown()",1000); 
        } 
    }; 
    $(function(){  //申请体验账户
        var uid = '{{ $userinfo->id }}';
        var gotourl = "{{url('/applyAccount')}}";
        $('.reg_time').click(function(){
                $.ajax({
                url:gotourl,
                type: 'post',
                headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
                data: { 'uid':uid },
                async: false,
                dataType:'json',
                success: function(res){
                    // 显示底下遮挡层并与body同宽高
                    var div_mask=$('#mask');
                    var width=document.body.scrollWidth+'px';
                    var height=document.body.scrollHeight+'px';
                    div_mask.css({'width':width,'height':height,'display':'block'});
                    // 返回json数据，判断状态
                    if(res.status == 0){
                        $('#mask').show();
                        $(".tanCeng").show();
                        $(".tanCeng > span").html("数据错误,请正确操作！");
                        $(".tanCeng > button").hide();
                        setInterval(function(){
                            $('#mask').hide();
                            $(".tanCeng").hide();
                        },3000);
                    }else if(res.status == 1){ //未完善资料,提示
                        $("#mask").show();
                        $(".tanCeng").show();
                        $(".tanCeng > span").html("您还未完善资料，请先去完善!");
                    }else if(res.status == 2) {  //完善资料,申请成功，倒计时开始
                        // 成功，倒计时开始
                        $("#mask").css('display','none');
                        $(".tanCeng").css('display','none');
                        $(".reg_time").hide();
                        endtime = Date.parse(new Date())/1000 + Number(tiyan*24*60*60);
                        timer = setInterval("daojishi()",1000);
                    }
                }
            });

        });
    });
    
    var endtime = Number('{{$userinfo->applytime+$tiyan*24*60*60}}');
    function daojishi(){   //申请过体验账户，并且没有过期，页面刷新倒计时
        clearInterval(timer);
        var  nowtime = Date.parse(new Date());
        var leftTime = (endtime * 1000 - nowtime) / 1000;
        if(leftTime >= 0) {
            var day = Math.floor(leftTime / 60 / 60 / 24); //计算剩余的天数 
            var hours = Math.floor(leftTime / 60 / 60 % 24); //计算剩余的小时 
            var minutes = Math.floor(leftTime / 60 % 60);//计算剩余的分钟 
            var seconds = Math.floor(leftTime % 60);//计算剩余的秒数 
            msg = "<span style='font-size:12px;'>体验账户倒计时： </span>"+"<span style='font-size:14px;'>"+day+"</span>"+"<span style='font-size:12px;'>天</span>"+"<span style='font-size:14px;'>" +hours+"</span>"+"<span style='font-size:12px;'>小时</span>" +"<span style='font-size:14px;'>"+minutes+"</span>"+"<span style='font-size:12px;'>分</span>"+"<span style='font-size:14px;'>"+seconds+"</span>"+"<span style='font-size:12px;'>秒</span>"; 
            $('#aBox').html(msg);
            // --leftTime;
            timer=setInterval("daojishi()",1000);
        }else{
            clearInterval(timer);
            $('#aBox').html('您的体验已结束,<a href="javascript:;" style="font-size:14px;color:#f6a405;cursor:pointer;">请充值！</a>');
        }
    }
</script>

